<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
      
    <ui:composition template="/new-template/template-crud.xhtml">
    	
    	<ui:define name="tituloPagina">
    		<h:outputText value="M&oacute;dulos :: Controle de Acesso :: SEDUC" />
    	</ui:define>
    	
    	<ui:define name="parametros">
    	   <ui:param name="bean" value="#{moduloBean}" />
    	</ui:define>
    	
    	<ui:define name="tituloFieldSetFiltro">
		   <h:outputText value="&nbsp; Pesquisa de M&oacute;dulos &nbsp;" />
		</ui:define>
		
		<ui:define name="camposFiltro">
		
		  <h:panelGrid id="painelGroup" columns="2" columnClasses="colunaBusca">		  		
			<h:outputLabel value="Nome: "/>
			<h:inputText id="inputText" value="#{moduloBean.entitySearch.descricao}" 
						 size="50" maxlength="50"	>
			   	<f:converter converterId="converterStringVazia"/>
				<f:validator validatorId="textoValidator"/>
			</h:inputText>
		  </h:panelGrid>	
				  	
		</ui:define>
		
		<ui:define name="tituloPainel">
		  <ui:param name="tituloPainel" value="M&oacute;dulos" /> 
		</ui:define>
		
		<ui:define name="resultFiltro">
				<p:dataTable align="center" 
   							 width="600px" 
   							 id="modulos"
   							 rows="10"
   						 	 emptyMessage="Nenhum m&oacute;dulo foi encontrado."
   						 	 value="#{moduloBean.resultSearch}" 
       					 	 var="modulo" 
       					 	 paginator="#{moduloBean.resultSearch.rowCount > 0}"
       					 	 paginatorPosition="bottom"
       					 	 rowStyleClass="bgLinha1,bgLinha2">
       					
       						<p:column headerText="" styleClass="colunaAcao">
									<h:commandButton id="cmdUpd"
												     style="border:none;" 
													 image="#{resource['img:ico_edit.gif']}"
													 actionListener="#{moduloBean.prepareUpdate}">
										<p:ajax update=":painelGlobal" />
									</h:commandButton>
       						</p:column>
       						
       						<p:column headerText="ID" style="text-align:center;">
       							<h:outputText value="#{modulo.id}" />
       						</p:column>
       						
       						<p:column headerText="Nome" style="text-align:left;" >
       							<h:outputText value="#{modulo.descricao}" />
       						</p:column>
       						
       						<p:column style="width:60px; text-align:center;">
       							<f:facet name="header">
       								<h:selectBooleanCheckbox styleClass="ui-checkBoxMain" rendered="#{moduloBean.resultSearch.rowCount > 0}" />
       							</f:facet>
       							<h:selectBooleanCheckbox styleClass="ui-checkBox" valueChangeListener="#{moduloBean.select}" />
       						</p:column>
       						
				 	</p:dataTable> 
		</ui:define>
		
		<ui:define name="tituloFieldSetInsert">
		  <h:outputLabel value="&nbsp; Cadastro de M&oacute;dulos &nbsp;" />
		</ui:define>
		
		<ui:define name="camposInsert">
		   <h:panelGrid columns="2" columnClasses="colunaBusca">
			  <h:outputLabel value="Nome: *"/>
			  <h:inputText required="true" 
						   label="Nome"
						   value="#{moduloBean.entity.descricao}" 
						   maxlength="50" 
						   size="40">						
			  </h:inputText>
			</h:panelGrid>
		</ui:define>
		
    </ui:composition>
</html>